package com.practice.car.cardataapp.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * demo-springboot project
 *
 * @author FlagDied
 * @date 2020/8/3
 */
@Configuration
public class WebMvcConfigurerImpl implements WebMvcConfigurer {
	@Override
	public void addCorsMappings(CorsRegistry registry) {//配置前后端跨域
		registry.addMapping("/**")
				.allowedOrigins("http://localhost:8080")
				.allowCredentials(true);
//				.maxAge(3600)
//				.allowedMethods()//Default:Post Get Head
	}
}
